import AxiosDIY, { payload } from '@/service/axios.ts';

/* 接口文档common部分，请查阅https://hengji.ieieye.com/ruoshui/docs/接口文档 */
export const iuserApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/iuser/');
export const iuserById = (payload: payload) => AxiosDIY(payload, `/ruoshui/common/rest/iuser/${payload.id}/`);

export const iuserInfo = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/iuser/info/');
export const iuserLogout = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/iuser/logout/');

export const iuserRegister = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/iuser/register/');

export const iuserPhonecode = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/iuser/phonecode/');

export const iuserPhonenocodelogin = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/iuser/phonenocodelogin/');

/* 接口文档flow部分，请查阅https://hengji.ieieye.com/ruoshui/docs/接口文档 */
export const flowApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/flow/');
export const flowById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/flow/${payload.id}/`);

export const nodeApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/node/');
export const nodeById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/node/${payload.id}/`);

export const edgeApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/edge/');
export const edgeById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/edge/${payload.id}/`);
export const edgeByIdClick = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/edge/${payload.id}/click/`);

export const eventApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/event/');
export const eventById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/event/${payload.id}/`);

export const formApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/form/');
export const formById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/form/${payload.id}/`);

export const eventlogApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/eventlog/');
export const eventlogById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/eventlog/${payload.id}/`);

export const eventnodeuserApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/eventnodeuser/');
export const eventnodeuserById = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/eventnodeuser/${payload.id}/`);
export const eventnodeuserCount = (payload: payload) => AxiosDIY(payload, '/ruoshui/flow/rest/eventnodeuser/count/');

export const roleApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/role/');

export const fileApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/common/rest/file/');

export const api = {
  development: '/developHost',
  staging: `//${window.location.host}`,
  production: `//${window.location.host}`,
}[import.meta.env.MODE];


export const eventByIdMessage = (payload: payload) => AxiosDIY(payload, `/ruoshui/flow/rest/event/${payload.id}/message/`);

export const spaceApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/space/rest/space/');
export const spaceById = (payload: payload) => AxiosDIY(payload, `/ruoshui/space/rest/space/${payload.id}/`);
export const space2userApi = (payload: payload) => AxiosDIY(payload, '/ruoshui/space/rest/space2user/');
export const space2userById = (payload: payload) => AxiosDIY(payload, `/ruoshui/space/rest/space2user/${payload.id}/`);